package com.seveneight.baijiesteward.ui.share.activity;

import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

import com.flyco.animation.BaseAnimatorSet;
import com.flyco.animation.BounceEnter.BounceTopEnter;
import com.seveneight.baijiesteward.R;
import com.seveneight.baijiesteward.base.BaseActivity;
import com.seveneight.baijiesteward.utils.GlideLoader;
import com.seveneight.baijiesteward.utils.ShareUtil;
import com.seveneight.baijiesteward.utils.ToastUtil;
import com.seveneight.baijiesteward.views.ShareBottomDialog;

import butterknife.BindView;

/**
 * Created by user1 on 2018/3/24.
 */

public class ShareActivity extends BaseActivity implements View.OnClickListener {

    @BindView(R.id.iv_shareImg)
    ImageView iv_shareImg;
    @BindView(R.id.iv_back)
    ImageView iv_back;
    @BindView(R.id.iv_share)
    ImageView iv_share;
    private String path;
    private ShareBottomDialog dialog;
    private BaseAnimatorSet mBasIn;

    @Override
    protected void initLayout() {
        setContentView(R.layout.activity_share);
    }

    @Override
    protected void initView() {
        Bundle bundle = getIntent().getExtras();
        if (bundle != null) {
            path = bundle.getString("path");
            GlideLoader.displayImg(activity, path, iv_shareImg);
        }
    }

    @Override
    protected void initData() {
        mBasIn = new BounceTopEnter();
    }

    @Override
    protected void setListener() {
        iv_back.setOnClickListener(this);
        iv_share.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.iv_back:
                finish();
                break;
            case R.id.iv_share:
                dialog = new ShareBottomDialog(activity, this);
                dialog.showAnim(mBasIn)//
                        .show();//
                break;
            case R.id.iv_shareFriend:
                ShareUtil.shareFriend(activity,path);
                dialog.dismiss();
                break;
            case R.id.iv_shareMonment:
                ShareUtil.shareMoment(activity,path);
                dialog.dismiss();
                break;
        }
    }
}
